//
//  DiscoverTableViewCell.m
//  ShanghaiShopping
//
//  Created by KDC on 2019/8/23.
//  Copyright © 2019 KDC. All rights reserved.
//

#import "DiscoverTableViewCell.h"
#import "JSONDiscoverModel.h"


@interface DiscoverTableViewCell ()

@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (weak, nonatomic) IBOutlet UIImageView *bottomImage;
@property (weak, nonatomic) IBOutlet UILabel *bottomTitle;
@property (weak, nonatomic) IBOutlet UIButton *praise;

@end

@implementation DiscoverTableViewCell

/**
 点赞

 @param sender <#sender description#>
 */
- (IBAction)actionPraise:(id)sender {
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)updateDiscoverTableViewCellWithModel:(ListNightSHTweetModel *)model {
    if (model.cssType == 3) {
        [self.image sd_setImageWithURL:[NSURL URLWithString:DSStringValue(model.videoBgImgPath)] placeholderImage:LHYPlaceholderImage];
    } else {
        [self.image sd_setImageWithURL:[NSURL URLWithString:DSStringValue(model.imgPath[0])] placeholderImage:LHYPlaceholderImage];
    }
    self.title.text = model.title;
    self.bottomTitle.text = model.fromName;
    [self.bottomImage sd_setImageWithURL:[NSURL URLWithString:DSStringValue(model.fromLogo)] placeholderImage:LHYPlaceholderImage];
}

- (void)updateDiscoverTableViewCellWithdata:(NSDictionary *)data {
    if ([data[@"imgPath"] isKindOfClass:[NSArray class]]) {
        [self.image sd_setImageWithURL:[NSURL URLWithString:DSStringValue(data[@"imgPath"][0])] placeholderImage:LHYPlaceholderImage];
    } else {
        [self.image sd_setImageWithURL:[NSURL URLWithString:DSStringValue(data[@"imgPath"])] placeholderImage:LHYPlaceholderImage];
    }
    self.title.text = DSStringValue(data[@"title"]);
    self.bottomTitle.text = DSStringValue(data[@"fromName"]);
    [self.bottomImage sd_setImageWithURL:[NSURL URLWithString:DSStringValue(data[@"fromLogo"])] placeholderImage:LHYPlaceholderImage];
}

@end
